package com.zhongxing.administrator.spritelhd.view;

import android.content.Context;
import android.view.animation.Animation;
import android.view.animation.ScaleAnimation;
import android.view.animation.TranslateAnimation;
import android.widget.ImageView;
import android.widget.RelativeLayout;

import com.zhongxing.administrator.spritelhd.R;

/**
 * Created by Administrator on 2017/7/1.
 */

public class ShopView extends BaseView{
    private ImageView iv_figure;
    private RelativeLayout ll_shop_btn;


    public ShopView(Context context) {
        super(context);
        setContentView(R.layout.view_shop);
        initUI();
    }
   public void show(){
       TranslateAnimation translateAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF,0f,
               Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,-1f,Animation.RELATIVE_TO_SELF,0f);
       translateAnimation.setDuration(300);
       ll_shop_btn.startAnimation(translateAnimation);


   }
   public  void hide(){
       TranslateAnimation translateAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF,0f,
               Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,1f,Animation.RELATIVE_TO_SELF,0f);
       translateAnimation.setDuration(300);
       ll_shop_btn.startAnimation(translateAnimation);


   }



    @Override
    public void initUI() {
        iv_figure =(ImageView) findViewById(R.id.iv_figure);
        ll_shop_btn = (RelativeLayout) findViewById(R.id.rl_shop_btn);
        ScaleAnimation scaleAnimation = new ScaleAnimation(1f,1f,1f,0.95f,Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,1f);
        scaleAnimation.setDuration(600);
        scaleAnimation.setRepeatCount(-1);
        scaleAnimation.setRepeatMode(Animation.REVERSE);
        iv_figure.setAnimation(scaleAnimation);

    }


}
